package cn.wit.summit.chwan.adapters;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.support.annotation.NonNull;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.text.Layout;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Animation;
import android.view.animation.AnimationUtils;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.facebook.drawee.controller.AbstractDraweeController;
import com.facebook.drawee.view.SimpleDraweeView;
import com.facebook.imagepipeline.postprocessors.IterativeBoxBlurPostProcessor;
import com.facebook.imagepipeline.request.ImageRequest;
import com.facebook.imagepipeline.request.ImageRequestBuilder;

import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Random;

import cn.wit.summit.chwan.R;
import cn.wit.summit.chwan.models.dto.CommentAlllistIntentData;
import cn.wit.summit.chwan.models.dto.CommentBaseBean;
import cn.wit.summit.chwan.models.dto.GameInfoDetialV2Bean;
import cn.wit.summit.chwan.models.dto.GamePrizesBean;
import cn.wit.summit.chwan.models.dto.GameTagInfoBean;
import cn.wit.summit.chwan.ui.activity.CommentAllListV2Activity;
import cn.wit.summit.chwan.ui.activity.PrizesGameListActivity;
import cn.wit.summit.chwan.utils.AccountUtil;
import cn.wit.summit.chwan.utils.DateUtils;
import cn.wit.summit.chwan.utils.IntentUtil;
import cn.wit.summit.chwan.utils.StringUtils;
import cn.wit.summit.chwan.utils.UtilsMy;
import cn.wit.summit.chwan.widgets.FlowLayout;
import cn.wit.summit.chwan.widgets.MStarBar;
import cn.wit.summit.chwan.widgets.VipView;

/**
 * Created by Alan on 2018/7/10.
 */

public class GameDetailV2Adapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private Activity mContext;
    private List<ViewBean> datas;
    private LayoutInflater inflater;
    private Listener mListenr = null;
    private String gameId;
    private Map<Integer,ImageView> tempUpIv = new HashMap<>();
    private Map<Integer,ImageView> tempDownIv = new HashMap<>();
    private Map<Integer,TextView> tempUpTv = new HashMap<>();
    private Map<Integer,TextView> tempDownTv = new HashMap<>();

    private Map<Integer, Boolean> mapMore = new HashMap<>();

    public GameDetailV2Adapter(Activity context, List<ViewBean> datas, String gameId) {
        this.mContext = context;
        this.datas = datas;
        this.gameId = gameId;
        inflater = LayoutInflater.from(mContext);
    }

    public void setListenr(Listener mListenr) {
        this.mListenr = mListenr;
    }

    public void setGameId(String gameId) {
        this.gameId = gameId;
    }

    public enum ViewType {
        TYPE_HEADER_TOP,
        TYPE_HEADER_BOTTOM,
        TYPE_HEADER_PRIZE,
        TYPE_HEADER_TITLE,
        TYPE_HEADER_EDIT_MESSAGE,
        TYPE_HEADER_INTRODUCE,
        TYPE_HEADER_GAME_PIC,
        TYPE_HEADER_COMMENT_TITLE,
        TYPE_COMMENT,
        TYPE_COMMENT_LINE,
        TYPE_NO_COMMENT,
        TYPE_MAY_LIKE
    }

    public static class ViewBean {
        ViewType viewType;
        Object obj;
        String gameCommentSwitch;

        public ViewBean() {
        }

        public ViewBean(ViewType viewType, Object obj) {
            this.viewType = viewType;
            this.obj = obj;
        }

        public ViewBean(ViewType viewType, Object obj, String gameCommentSwitch) {
            this.viewType = viewType;
            this.obj = obj;
            this.gameCommentSwitch = gameCommentSwitch;
        }

        public String getGameCommentSwitch() {
            return gameCommentSwitch;
        }

        public void setGameCommentSwitch(String gameCommentSwitch) {
            this.gameCommentSwitch = gameCommentSwitch;
        }

        public ViewType getViewType() {
            return viewType;
        }

        public void setViewType(ViewType viewType) {
            this.viewType = viewType;
        }

        public Object getObj() {
            return obj;
        }

        public void setObj(Object obj) {
            this.obj = obj;
        }
    }

    @Override
    public int getItemViewType(int position) {
        if (datas != null) {
            return datas.get(position).getViewType().ordinal();
        }
        return -1;
    }

    @NonNull
    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
        RecyclerView.ViewHolder holder = null;

        //加载Item View的时候根据不同TYPE加载不同的布局
        if (viewType == ViewType.TYPE_HEADER_TOP.ordinal()) {
            holder = new HeaderTopHolder(inflater.inflate(R.layout.item_game_detail_new_header_view, parent, false));
        } else if (viewType == ViewType.TYPE_HEADER_BOTTOM.ordinal()) {
            holder = new HeaderBottomHolder(inflater.inflate(R.layout.item_game_detail_new_header_two_view, parent, false));
        } else if (viewType == ViewType.TYPE_HEADER_PRIZE.ordinal()) {
            holder = new PrizeHolder(inflater.inflate(R.layout.item_game_detail_new_prize_view, parent, false));
        } else if (viewType == ViewType.TYPE_HEADER_TITLE.ordinal()) {
            holder = new TitleHolder(inflater.inflate(R.layout.item_game_detail_new_title_view, parent, false));
        } else if (viewType == ViewType.TYPE_HEADER_EDIT_MESSAGE.ordinal()) {
            holder = new EditMessageHolder(inflater.inflate(R.layout.item_game_detail_new_edit_message_view, parent, false));
        } else if (viewType == ViewType.TYPE_HEADER_INTRODUCE.ordinal()) {
            holder = new IntroduceHolder(inflater.inflate(R.layout.item_game_detail_new_introduce_view, parent, false));
        } else if (viewType == ViewType.TYPE_HEADER_GAME_PIC.ordinal()) {
            holder = new PicListHolder(inflater.inflate(R.layout.item_game_detail_new_pic_list_view, parent, false));
        } else if (viewType == ViewType.TYPE_HEADER_COMMENT_TITLE.ordinal()) {
            holder = new CommentTitleHolder(inflater.inflate(R.layout.item_game_detail_new_comment_title_view, parent, false));
        } else if (viewType == ViewType.TYPE_COMMENT.ordinal()) {
            holder = new CommentHolder(inflater.inflate(R.layout.item_game_detail_new_comment_view, parent, false));
        } else if (viewType == ViewType.TYPE_COMMENT_LINE.ordinal()) {
            holder = new CommentLineHolder(inflater.inflate(R.layout.item_game_detail_new_comment_line_view, parent, false));
        } else if (viewType == ViewType.TYPE_NO_COMMENT.ordinal()) {
            holder = new NoCommentHolder(inflater.inflate(R.layout.item_game_detail_new_no_comment_view, parent, false));
        } else if (viewType == ViewType.TYPE_MAY_LIKE.ordinal()) {
            holder = new MayLikeHolder(inflater.inflate(R.layout.item_game_detail_new_may_like_view, parent, false));
        }
        return holder;
    }

    @Override
    public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, final int position) {
        ViewBean viewBean = datas.get(position);
        if (holder instanceof HeaderTopHolder) {
            GameInfoDetialV2Bean mBean = (GameInfoDetialV2Bean) viewBean.getObj();
            HeaderTopHolder mHeaderTopHolder = (HeaderTopHolder) holder;

            GameInfoDetialV2Bean.GameSlidePicBean mGameSlidePicBean = mBean.getGame_slide_pic();
            if (mGameSlidePicBean!=null && mGameSlidePicBean.getPic_list()!=null && mGameSlidePicBean.getPic_list().size()>0) {
                String bgUrl = mGameSlidePicBean.getPic_list().get(0);
                if (!StringUtils.isEmpty(bgUrl)) {
                    showUrlBlur(mHeaderTopHolder.detailHeaderBgIv, bgUrl, 3);
                }
            }

            String imgUrl = mBean.getGame_ico();
            if (!StringUtils.isEmpty(imgUrl))
                mHeaderTopHolder.detailHeaderIv.setImageURI(imgUrl);

            mHeaderTopHolder.detailHeaderGameNameTv.setText(mBean.getGame_name());

            GameInfoDetialV2Bean.GameScoreBean gameScoreBean = mBean.getGame_score();
            if (gameScoreBean!=null) {
                mHeaderTopHolder.Ll1.setVisibility(View.VISIBLE);
                String tempNum = gameScoreBean.getScore();
                if (StringUtils.isEmpty(tempNum))
                    tempNum = "0";
                double pointNum = Double.valueOf(tempNum);
                if (pointNum==0) {
                    mHeaderTopHolder.Ll1.setVisibility(View.INVISIBLE);
                } else {
                    mHeaderTopHolder.Ll1.setVisibility(View.VISIBLE);
                }

                mHeaderTopHolder.detailHeaderPointTv.setText(""+pointNum);
                if (pointNum>0 && pointNum<=1) {
                    pointNum = 0.5;
                } else if (pointNum>1 && pointNum<=2) {
                    pointNum = 1.0;
                } else if (pointNum>2 && pointNum<=3) {
                    pointNum = 1.5;
                } else if (pointNum>3 && pointNum<=4) {
                    pointNum = 2.0;
                } else if (pointNum>4 && pointNum<=5) {
                    pointNum = 2.5;
                } else if (pointNum>5 && pointNum<=6) {
                    pointNum = 3.0;
                } else if (pointNum>6 && pointNum<=7) {
                    pointNum = 3.5;
                } else if (pointNum>7 && pointNum<=8) {
                    pointNum = 4.0;
                } else if (pointNum>8 && pointNum<=9) {
                    pointNum = 4.5;
                } else if (pointNum>9 && pointNum<=10) {
                    pointNum = 5.0;
                }
                mHeaderTopHolder.detailHeaderMstarBar.setIntegerMark(false);
                mHeaderTopHolder.detailHeaderMstarBar.setEnabled(false);
                mHeaderTopHolder.detailHeaderMstarBar.setStarMark(pointNum);
                mHeaderTopHolder.detailHeaderDecTx.setText(getTxByPoint(pointNum));
            } else {
                mHeaderTopHolder.Ll1.setVisibility(View.INVISIBLE);
            }

            List<GameTagInfoBean> tags = mBean.getGame_tag_info_v2();
            if (tags!=null) {
                addTags(tags, mHeaderTopHolder.detailHeaderTipsFl);
            }

            String decStr = "";
            String size = mBean.getGame_size();
            if (!StringUtils.isEmpty(size)) {
                decStr += size+"M";
            }
            if (!StringUtils.isEmpty(decStr))
                decStr += " · ";
            String ver = mBean.getGame_ver_name();
            if (!StringUtils.isEmpty(ver)) {
                decStr += "V"+ver;
            }
//            if (!StringUtils.isEmpty(decStr))
//                decStr += " · ";
//            decStr += mBean.getGame_down_count()+"热度";
            mHeaderTopHolder.detailHeaderTagTv.setText(decStr);
        } else if (holder instanceof HeaderBottomHolder) {
            GameInfoDetialV2Bean mBean = (GameInfoDetialV2Bean) viewBean.getObj();
            HeaderBottomHolder mHeaderBottomHolder = (HeaderBottomHolder) holder;

            mHeaderBottomHolder.detailHeaderTwoBgIv.setBackgroundResource(getRamDrawable());
            String pojie = mBean.getGame_explain();
            if (!StringUtils.isEmpty(pojie)) {
                mHeaderBottomHolder.gameDetailCrackLl.setVisibility(View.VISIBLE);
                mHeaderBottomHolder.gameDetailCrackTx.setText(pojie);
            } else {
                mHeaderBottomHolder.gameDetailCrackLl.setVisibility(View.GONE);
            }
            String adapterSys = mBean.getGame_system_ver();
            if (!StringUtils.isEmpty(adapterSys)) {
                mHeaderBottomHolder.gameDetailAdaptationSystemLl.setVisibility(View.VISIBLE);
                mHeaderBottomHolder.gameDetailAdaptationSystemTx.setText(adapterSys);
            } else {
                mHeaderBottomHolder.gameDetailAdaptationSystemLl.setVisibility(View.GONE);
            }
        } else if (holder instanceof PrizeHolder) {
            final GamePrizesBean mBean = (GamePrizesBean) viewBean.getObj();
            PrizeHolder mPrizeHolder = (PrizeHolder) holder;

            String icoUrl = mBean.getPic();
            if (!StringUtils.isEmpty(icoUrl))
                mPrizeHolder.detailPrizeIv.setImageURI(icoUrl);
            String str = mBean.getTitle();
            if (str.contains(" ")) {
                String[] strlist = mBean.getTitle().split(" ");
                if (strlist.length>1) {
                    mPrizeHolder.detailPrizeNameTv.setText(strlist[0]);
                    String strLast = "";
                    mPrizeHolder.detailPrizeRankingTv.setText(strlist[1]);
                    if (strlist.length>2) {
                        for (int i=2;i<strlist.length;i++) {
                            if (i!=2) {
                                strLast += " ";
                            }
                            strLast += strlist[i];
                        }
                        mPrizeHolder.detailPrizeLastTv.setText(strLast);
                    }
                } else {
                    mPrizeHolder.detailPrizeNameTv.setText(strlist[0]);
                    mPrizeHolder.detailPrizeRankingTv.setText("");
                }
            } else {
                mPrizeHolder.detailPrizeNameTv.setText(str);
                mPrizeHolder.detailPrizeRankingTv.setText("");
            }
            mPrizeHolder.detailPrizeRootRl.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    Intent intent = new Intent(mContext, PrizesGameListActivity.class);
                    intent.putExtra("prize_id",mBean.getPrize_type_id()+"");
                    mContext.startActivity(intent);
                }
            });
        } else if (holder instanceof TitleHolder) {
            String mBean = (String) viewBean.getObj();
            TitleHolder mTitleHolder = (TitleHolder) holder;

            mTitleHolder.detailTitleNameTv.setText(mBean);
        } else if (holder instanceof EditMessageHolder) {
            String mBean = (String) viewBean.getObj();
            EditMessageHolder mEditMessageHolder = (EditMessageHolder) holder;

            mEditMessageHolder.detailEditMessageTv.setText(mBean);
        } else if (holder instanceof IntroduceHolder) {
            final GameInfoDetialV2Bean mBeanData = (GameInfoDetialV2Bean) viewBean.getObj();
            final String mBean = (String) viewBean.getGameCommentSwitch();
            final IntroduceHolder mIntroduceHolder = (IntroduceHolder) holder;
            mIntroduceHolder.detailIntroduceTv.setText(mBean);

            mIntroduceHolder.messageLl.setVisibility(View.GONE);

            String uploadName = mBeanData.getGame_upload_author();
            if (StringUtils.isEmpty(uploadName)) {
                mIntroduceHolder.uploadPeopleTx.setVisibility(View.GONE);
            } else {
                mIntroduceHolder.uploadPeopleTx.setVisibility(View.VISIBLE);
                mIntroduceHolder.uploadPeopleTx.setText("上传者："+uploadName);
            }

            String companyName = mBeanData.getGame_company_name();
            if (StringUtils.isEmpty(companyName)) {
                mIntroduceHolder.manufacturerTx.setVisibility(View.GONE);
            } else {
                mIntroduceHolder.manufacturerTx.setVisibility(View.VISIBLE);
                mIntroduceHolder.manufacturerTx.setText("厂商："+companyName);
            }

            //动态判断设置行数
            if (mapMore.containsKey(position) && mapMore.get(position)) {
                mIntroduceHolder.detailIntroduceMoreTv.setText("收起");
                mIntroduceHolder.detailIntroduceTv.setMaxLines(Integer.MAX_VALUE);
                mIntroduceHolder.moreUpIv.setVisibility(View.GONE);
                mIntroduceHolder.messageLl.setVisibility(View.VISIBLE);
            } else {
                mIntroduceHolder.moreUpIv.setVisibility(View.VISIBLE);
                mIntroduceHolder.messageLl.setVisibility(View.GONE);
                mIntroduceHolder.detailIntroduceMoreTv.setText("查看全部");
                mIntroduceHolder.detailIntroduceTv.setMaxLines(5);
            }

            mIntroduceHolder.detailIntroduceTv.post(new Runnable() {
                @Override
                public void run() {
                    Layout l = mIntroduceHolder.detailIntroduceTv.getLayout();
                    if (l != null) {
                        int lines = l.getLineCount();
                        if (lines > 0) {
                            if (lines > 5) {
                                mIntroduceHolder.detailIntroduceMoreTv.setVisibility(View.VISIBLE);
                            } else {
                                int num = l.getEllipsisCount(lines - 1);
                                if (num > 0) {
                                    mIntroduceHolder.detailIntroduceMoreTv.setVisibility(View.VISIBLE);
                                } else {
                                    if (mapMore.containsKey(position) && mapMore.get(position)) {
                                        mIntroduceHolder.detailIntroduceMoreTv.setVisibility(View.VISIBLE);
                                    } else {
                                        mIntroduceHolder.detailIntroduceMoreTv.setVisibility(View.GONE);
                                        mIntroduceHolder.moreUpIv.setVisibility(View.GONE);
                                        mIntroduceHolder.messageLl.setVisibility(View.VISIBLE);
                                    }
                                }
                            }
                        }
                    } else {
                        mIntroduceHolder.detailIntroduceMoreTv.setVisibility(View.GONE);
                        mIntroduceHolder.moreUpIv.setVisibility(View.GONE);
                        mIntroduceHolder.messageLl.setVisibility(View.VISIBLE);
                    }
                }
            });

            //监听点击"查看全部"按钮点击事件
            mIntroduceHolder.detailIntroduceMoreTv.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    String s = mIntroduceHolder.detailIntroduceMoreTv.getText().toString();
                    if (s.equals("查看全部")) {
                        if (android.os.Build.VERSION.SDK_INT == 19) {
                            mIntroduceHolder.detailIntroduceTv.setText(mBean);
                        }
                        mIntroduceHolder.detailIntroduceTv.setMaxLines(Integer.MAX_VALUE);
                        mIntroduceHolder.detailIntroduceMoreTv.setText("收起");
                        mIntroduceHolder.moreUpIv.setVisibility(View.GONE);
                        mIntroduceHolder.messageLl.setVisibility(View.VISIBLE);
                        mapMore.put(position, true);
                    } else {
                        if (android.os.Build.VERSION.SDK_INT == 19) {
                            mIntroduceHolder.detailIntroduceTv.setText(mBean.replaceAll("\n", ""));
                        }
                        mIntroduceHolder.detailIntroduceTv.setMaxLines(5);
                        mIntroduceHolder.detailIntroduceMoreTv.setText("查看全部");
                        mIntroduceHolder.moreUpIv.setVisibility(View.VISIBLE);
                        mIntroduceHolder.messageLl.setVisibility(View.GONE);
                        mapMore.put(position, false);
                    }
                }
            });


        } else if (holder instanceof PicListHolder) {
            List<GameInfoDetialV2Bean.GameScreenShotBean> mBean = (List<GameInfoDetialV2Bean.GameScreenShotBean>) viewBean.getObj();
            PicListHolder mPicListHolder = (PicListHolder) holder;

            if (mBean.size() == 0) {
                mPicListHolder.detailScreenLv.setVisibility(View.GONE);
                mPicListHolder.imageItemRootLl.setVisibility(View.GONE);
            } else {
                mPicListHolder.detailScreenLv.setVisibility(View.VISIBLE);
                mPicListHolder.imageItemRootLl.setVisibility(View.VISIBLE);
                if (mPicListHolder.detailScreenLv != null) {
                    GameDetailV2RImageAdapter imageAdapter = new GameDetailV2RImageAdapter(mContext, mBean, gameId);
                    LinearLayoutManager layoutManager = new LinearLayoutManager(mContext);
                    layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
                    mPicListHolder.detailScreenLv.setLayoutManager(layoutManager);
                    mPicListHolder.detailScreenLv.setAdapter(imageAdapter);
                }
            }
        } else if (holder instanceof CommentTitleHolder) {
            int mBean = (int) viewBean.getObj();
            CommentTitleHolder mCommentTitleHolder = (CommentTitleHolder) holder;

            mCommentTitleHolder.detailNewCommentNumTv.setText("("+mBean+"条)");
            mCommentTitleHolder.detailNewCommentLl.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    CommentAlllistIntentData intentData = new CommentAlllistIntentData();
                    intentData.setGameId(gameId);
                    intentData.setPackageName("");
                    intentData.setGameType("");
                    intentData.setGameIsStart(1);
                    intentData.setSgcSwitch(0);
                    intentData.setBespeakSwitch(0);
                    intentData.setCommentScoreSwitch("");
                    Intent intent = new Intent(mContext, CommentAllListV2Activity.class);
                    intent.putExtra("intentData", intentData);
                    mContext.startActivity(intent);
                }
            });
        } else if (holder instanceof CommentLineHolder) {
        } else if (holder instanceof CommentHolder) {
            final CommentBaseBean commitDataBean = (CommentBaseBean) viewBean.getObj();
            CommentHolder commentHolder = (CommentHolder) holder;

            if (commitDataBean.getUid().equals(String.valueOf(AccountUtil.getInstance().getUid()))) {
                commentHolder.isMe.setVisibility(View.VISIBLE);
            } else {
                commentHolder.isMe.setVisibility(View.GONE);
            }

            if (commitDataBean.isIsfirst() && "1".equals(viewBean.getGameCommentSwitch())){
                commentHolder.detailNewStarLl.setVisibility(View.VISIBLE);
                commentHolder.goCommit.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (mListenr!=null)
                            mListenr.onPostingClick();
                    }
                });
            } else
                commentHolder.detailNewStarLl.setVisibility(View.GONE);

            if (StringUtils.isEmpty(commitDataBean.getUser_name())) {
                commentHolder.userName.setVisibility(View.GONE);
            } else {
                commentHolder.userName.setVisibility(View.VISIBLE);
                commentHolder.userName.setText(commitDataBean.getUser_name());
            }
            if (android.os.Build.VERSION.SDK_INT == 19) {
                commentHolder.content.setText(commitDataBean.getContent().replaceAll("\n", ""));
            } else {
                commentHolder.content.setText(commitDataBean.getContent());
            }
            if (commitDataBean.getIs_old() == 1 || commitDataBean.getMobile_phone_model() == null
                    || commitDataBean.getMobile_phone_model().isEmpty())
                commentHolder.phoneModle.setVisibility(View.INVISIBLE);
            else {
                commentHolder.phoneModle.setVisibility(View.VISIBLE);
                commentHolder.phoneModle.setText(commitDataBean.getMobile_phone_model());
            }
            commentHolder.pariseNumber.setText(commitDataBean.getPraise_count() + "");
            commentHolder.downNumber.setText(commitDataBean.getDespise_count() + "");
            commentHolder.messageNumber.setText(commitDataBean.getReply_count() + "");
            long timel = Long.parseLong(commitDataBean.getAdd_times() + "000");
            commentHolder.time.setText(DateUtils.FormatForDownloadTime(timel));

            if (commitDataBean.getApproval_rate() != null
                    && Double.valueOf(commitDataBean.getApproval_rate()) > 70)
                commentHolder.isGood.setVisibility(View.VISIBLE);
            else
                commentHolder.isGood.setVisibility(View.GONE);

            if (commitDataBean.getIs_praise() == 1) {
                commentHolder.parise.setImageResource(R.drawable.uped_ic);
            } else {
                commentHolder.parise.setImageResource(R.drawable.up_ic);
            }

            if (commitDataBean.getIs_despise() == 1) {
                commentHolder.down.setImageResource(R.drawable.downed_ic);
            } else {
                commentHolder.down.setImageResource(R.drawable.down_ic);
            }

            UtilsMy.setIconImage(mContext, commitDataBean.getHead_portrait(), commentHolder.userIcon);
            setOnPraiseListener(commentHolder.parise, commentHolder.pariseNumber, commitDataBean, position);
            setOnUnPraiseListener(commentHolder.down, commentHolder.downNumber, commitDataBean, position);

            setOnItemListener(commentHolder.message, commitDataBean);
            setOnItemListener(commentHolder.commentAllRootLl, commitDataBean);

            //动态判断设置行数
            if (commitDataBean.isShowMore()) {
                commentHolder.more.setText("收起");
                commentHolder.content.setMaxLines(Integer.MAX_VALUE);
                commentHolder.moreUpIv.setVisibility(View.GONE);
            } else {
                commentHolder.more.setText("查看全部");
                commentHolder.content.setMaxLines(5);
                commentHolder.moreUpIv.setVisibility(View.VISIBLE);
            }

            final CommentHolder finalCommentViewHolder1 = commentHolder;
            commentHolder.content.post(new Runnable() {
                @Override
                public void run() {
                    Layout l = finalCommentViewHolder1.content.getLayout();
                    if (l != null) {
                        int lines = l.getLineCount();
                        if (lines > 0) {
                            if (lines > 5) {
                                finalCommentViewHolder1.more.setVisibility(View.VISIBLE);
                            } else {
                                int num = l.getEllipsisCount(lines - 1);
                                if (num > 0) {
                                    finalCommentViewHolder1.more.setVisibility(View.VISIBLE);
                                } else {
                                    if (commitDataBean.isShowMore()) {
                                        finalCommentViewHolder1.more.setVisibility(View.VISIBLE);
                                    } else {
                                        finalCommentViewHolder1.more.setVisibility(View.GONE);
                                        finalCommentViewHolder1.moreUpIv.setVisibility(View.GONE);
                                    }
                                }
                            }
                        }
                    } else {
                        finalCommentViewHolder1.moreUpIv.setVisibility(View.GONE);
                        finalCommentViewHolder1.more.setVisibility(View.GONE);
                    }
                }
            });

            //监听点击"查看全部"按钮点击事件
            final CommentHolder finalCommentViewHolder = commentHolder;
            commentHolder.more.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    String s = finalCommentViewHolder.more.getText().toString();
                    if (s.equals("查看全部")) {
                        if (android.os.Build.VERSION.SDK_INT == 19) {
                            finalCommentViewHolder.content.setText(commitDataBean.getContent());
                        }
                        finalCommentViewHolder.content.setMaxLines(Integer.MAX_VALUE);
                        finalCommentViewHolder.more.setText("收起");
                        finalCommentViewHolder.moreUpIv.setVisibility(View.GONE);
                        commitDataBean.setShowMore(true);
                    } else {
                        if (android.os.Build.VERSION.SDK_INT == 19) {
                            finalCommentViewHolder.content.setText(commitDataBean.getContent().replaceAll("\n", ""));
                        }
                        finalCommentViewHolder.content.setMaxLines(5);
                        finalCommentViewHolder.more.setText("查看全部");
                        finalCommentViewHolder.moreUpIv.setVisibility(View.VISIBLE);
                        commitDataBean.setShowMore(false);
                    }
                }
            });
        } else if (holder instanceof NoCommentHolder) {
            NoCommentHolder noCommentHolder = (NoCommentHolder) holder;
            if ("1".equals(viewBean.getGameCommentSwitch())) {
                noCommentHolder.detailNewStarLl.setVisibility(View.VISIBLE);
                noCommentHolder.goCommit.setOnClickListener(new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        if (mListenr!=null)
                            mListenr.onPostingClick();
                    }
                });
            } else {
                noCommentHolder.detailNewStarLl.setVisibility(View.GONE);
            }
        } else if (holder instanceof MayLikeHolder) {
            List<GameInfoDetialV2Bean.GameMayBeLikeBean> mayList = (List<GameInfoDetialV2Bean.GameMayBeLikeBean>) viewBean.getObj();
            MayLikeHolder mayLikeHolder = (MayLikeHolder) holder;

            mayLikeHolder.mayLikeOneLl.setVisibility(View.INVISIBLE);
            mayLikeHolder.mayLikeTwoLl.setVisibility(View.INVISIBLE);
            mayLikeHolder.mayLikeThreeLl.setVisibility(View.INVISIBLE);
            for (int i=0;i<mayList.size();i++) {
                final GameInfoDetialV2Bean.GameMayBeLikeBean temp = mayList.get(i);
                String url = temp.getGame_ico();
                switch (i) {
                    case 0:
                        mayLikeHolder.mayLikeOneLl.setVisibility(View.VISIBLE);
                        mayLikeHolder.mayLikeOneLl.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                mListenr.onReflashThisView(String.valueOf(temp.getGame_id()));
                            }
                        });
                        if (!StringUtils.isEmpty(url))
                            mayLikeHolder.mayLikeOneIv.setImageURI(url);
                        mayLikeHolder.mayLikeOneGameNameTx.setText(temp.getGame_name());
                        mayLikeHolder.mayLikeOneGamePointTx.setText(temp.getGame_score());
                        mayLikeHolder.mayLikeOneGameStyleTx.setText(temp.getGame_tag());
                        mayLikeHolder.mayLikeOneGameRelationshopTx.setText(temp.getGame_describe());
                        break;
                    case 1:
                        mayLikeHolder.mayLikeTwoLl.setVisibility(View.VISIBLE);
                        mayLikeHolder.mayLikeTwoLl.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                mListenr.onReflashThisView(String.valueOf(temp.getGame_id()));
                            }
                        });
                        if (!StringUtils.isEmpty(url))
                            mayLikeHolder.mayLikeTwoIv.setImageURI(url);
                        mayLikeHolder.mayLikeTwoGameNameTx.setText(temp.getGame_name());
                        mayLikeHolder.mayLikeTwoGamePointTx.setText(temp.getGame_score());
                        mayLikeHolder.mayLikeTwoGameStyleTx.setText(temp.getGame_tag());
                        mayLikeHolder.mayLikeTwoGameRelationshopTx.setText(temp.getGame_describe());
                        break;
                    case 2:
                        mayLikeHolder.mayLikeThreeLl.setVisibility(View.VISIBLE);
                        mayLikeHolder.mayLikeThreeLl.setOnClickListener(new View.OnClickListener() {
                            @Override
                            public void onClick(View v) {
                                mListenr.onReflashThisView(String.valueOf(temp.getGame_id()));
                            }
                        });
                        if (!StringUtils.isEmpty(url))
                            mayLikeHolder.mayLikeThreeIv.setImageURI(url);
                        mayLikeHolder.mayLikeThreeGameNameTx.setText(temp.getGame_name());
                        mayLikeHolder.mayLikeThreeGamePointTx.setText(temp.getGame_score());
                        mayLikeHolder.mayLikeThreeGameStyleTx.setText(temp.getGame_tag());
                        mayLikeHolder.mayLikeThreeGameRelationshopTx.setText(temp.getGame_describe());
                        break;
                }
            }
        }
    }

    private void setOnItemListener(View view, final CommentBaseBean commitDataBean) {
        view.setOnClickListener(new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (commitDataBean == null)
                    return;
                if (mListenr != null) {
                    mListenr.onRootView(commitDataBean);
                }
            }
        });
    }

    private void setOnUnPraiseListener(final ImageView view, final TextView tv, final CommentBaseBean commitDataBean, final int position) {
        tempDownIv.put(position, view);
        tempDownTv.put(position, tv);
        View.OnClickListener temp = new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (isFastDoubleClick()) return;
                if (AccountUtil.getInstance().getUidNotToLogin(mContext) == 0) return;
                if (commitDataBean == null)
                    return;
                if (commitDataBean.getIs_despise() == 1) {
                    subDespise(position);
                    view.setImageResource(R.drawable.down_ic);
                    if (mListenr != null) {
                        mListenr.onUnPraise(commitDataBean, position, 2);
                    }
                    return;
                } else {
                    commitDataBean.setIs_despise(1);
                }

                if (AccountUtil.getInstance().getAccountData() != null) {
                    view.setImageResource(R.drawable.downed_ic);
                    Animation scaleAnim = AnimationUtils.loadAnimation(mContext, R.anim.scale_reset);
                    view.startAnimation(scaleAnim);
                    scaleAnim.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {

                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            long num = Long.valueOf(tv.getText().toString());
                            tv.setText((num + 1) + "");
                            addDespise(position);

                            if (mListenr != null) {
                                mListenr.onUnPraise(commitDataBean, position, 1);
                            }
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });
                } else {
                    IntentUtil.getInstance().goLoginInteractive(mContext);
                }
            }
        };
        view.setOnClickListener(temp);
        tv.setOnClickListener(temp);
    }

    /**
     * 防止快速点击,启动多个同样的界面
     *
     * @return
     */
    long lastClickTime;
    public boolean isFastDoubleClick() {
        long now = System.currentTimeMillis();
        long timeD = now - lastClickTime;
        lastClickTime = now;
        return timeD <= 500;
    }

    private void setOnPraiseListener(final ImageView view, final TextView tv, final CommentBaseBean commitDataBean, final int position) {
        tempUpIv.put(position, view);
        tempUpTv.put(position, tv);
        View.OnClickListener temp = new View.OnClickListener() {

            @Override
            public void onClick(View v) {
                if (isFastDoubleClick()) return;
                if (AccountUtil.getInstance().getUidNotToLogin(mContext) == 0) return;
                if (commitDataBean == null)
                    return;
                if (commitDataBean.getIs_praise() == 1) {
                    subPraise(position);
                    view.setImageResource(R.drawable.up_ic);
                    if (mListenr != null) {
                        mListenr.onPraise(commitDataBean, position, 2);
                    }
                    return;
                } else {
                    commitDataBean.setIs_praise(1);
                }

                if (AccountUtil.getInstance().getAccountData() != null) {
                    view.setImageResource(R.drawable.uped_ic);
                    Animation scaleAnim = AnimationUtils.loadAnimation(mContext, R.anim.scale_reset);
                    view.startAnimation(scaleAnim);
                    scaleAnim.setAnimationListener(new Animation.AnimationListener() {
                        @Override
                        public void onAnimationStart(Animation animation) {

                        }

                        @Override
                        public void onAnimationEnd(Animation animation) {
                            long num = Long.valueOf(tv.getText().toString());
                            tv.setText((num + 1) + "");
                            addPraise(position);

                            if (mListenr != null) {
                                mListenr.onPraise(commitDataBean, position, 1);
                            }
                        }

                        @Override
                        public void onAnimationRepeat(Animation animation) {

                        }
                    });
                } else {
                    IntentUtil.getInstance().goLoginInteractive(mContext);
                }
            }
        };

        view.setOnClickListener(temp);
        tv.setOnClickListener(temp);
    }

    public void addDespise(int position) {
        CommentBaseBean viewBean = (CommentBaseBean) getItem(position);

        long num = Long.valueOf(viewBean.getDespise_count());
        viewBean.setIs_despise(1);
        viewBean.setDespise_count(num + 1 + "");
    }

    public void subDespise(int position) {
        CommentBaseBean viewBean = (CommentBaseBean) getItem(position);

        long num = Long.valueOf(viewBean.getDespise_count());
        viewBean.setIs_despise(0);
        if (num - 1 < 0) {
            viewBean.setDespise_count("0");
            if (tempDownIv.containsKey(position) && tempDownIv.get(position)!=null) {
                tempDownTv.get(position).setText("0");
            }
        } else {
            viewBean.setDespise_count(num - 1 + "");
            if (tempDownIv.containsKey(position) && tempDownIv.get(position)!=null) {
                tempDownTv.get(position).setText((num - 1)+"");
            }
        }
    }

    public void addPraise(int position) {
        CommentBaseBean viewBean = (CommentBaseBean) getItem(position);

        long num = viewBean.getPraise_count();
        viewBean.setIs_praise(1);
        viewBean.setPraise_count(num + 1);
    }

    public void subPraise(int position) {
        CommentBaseBean viewBean = (CommentBaseBean) getItem(position);

        long num = viewBean.getPraise_count();
        viewBean.setIs_praise(0);
        if (num - 1 < 0) {
            viewBean.setPraise_count(0);
            if (tempUpTv.containsKey(position) && tempUpTv.get(position)!=null) {
                tempUpTv.get(position).setText("0");
            }
        } else {
            viewBean.setPraise_count(num - 1);
            if (tempUpTv.containsKey(position) && tempUpTv.get(position)!=null) {
                tempUpTv.get(position).setText((num - 1)+"");
            }
        }
    }

    public void resetPraise(int position, int state) {
        CommentBaseBean viewBean = (CommentBaseBean) getItem(position);

        long num = viewBean.getPraise_count();
        if (viewBean.getIs_praise() == 1) {
            viewBean.setIs_praise(0);
            if (num - 1 < 0) {
                viewBean.setPraise_count(0);

                if (tempUpIv.containsKey(position) && tempUpIv.get(position)!=null) {
                    tempUpIv.get(position).setImageResource(R.drawable.up_ic);
                    tempUpTv.get(position).setText("0");
                }
            } else {
                viewBean.setPraise_count(num - 1);

                if (tempUpIv.containsKey(position) && tempUpIv.get(position)!=null) {
                    tempUpIv.get(position).setImageResource(R.drawable.up_ic);
                    tempUpTv.get(position).setText(""+(num - 1));
                }
            }
        } else {
            if (state != 1) {
                viewBean.setIs_praise(1);
                viewBean.setPraise_count(num + 1);

                if (tempUpIv.containsKey(position) && tempUpIv.get(position)!=null) {
                    tempUpIv.get(position).setImageResource(R.drawable.uped_ic);
                    tempUpTv.get(position).setText(""+(num + 1));
                }
            }
        }
    }

    public void resetDespise(int position, int state) {
        CommentBaseBean viewBean = getItem(position);
        long num = Long.valueOf(viewBean.getDespise_count());
        if (viewBean.getIs_despise() == 1) {
            viewBean.setIs_despise(0);
            if (num - 1 < 0) {
                viewBean.setDespise_count("0");

                if (tempDownIv.containsKey(position) && tempDownIv.get(position)!=null) {
                    tempDownIv.get(position).setImageResource(R.drawable.down_ic);
                    tempDownTv.get(position).setText("0");
                }
            } else {
                viewBean.setDespise_count(num - 1 + "");

                if (tempDownIv.containsKey(position) && tempDownIv.get(position)!=null) {
                    tempDownIv.get(position).setImageResource(R.drawable.down_ic);
                    tempDownTv.get(position).setText(""+(num - 1));
                }
            }
        } else {
            if (state != 1) {
                viewBean.setIs_despise(1);
                viewBean.setDespise_count(num + 1 + "");

                if (tempDownIv.containsKey(position) && tempDownIv.get(position)!=null) {
                    tempDownIv.get(position).setImageResource(R.drawable.downed_ic);
                    tempDownTv.get(position).setText(""+(num - 1));
                }
            }
        }
    }

    private CommentBaseBean getItem(int position) {
        CommentBaseBean commitDataBean = (CommentBaseBean) datas.get(position).getObj();
        return commitDataBean;
    }

    private String getTxByPoint(double pointNum) {
        String str = "";
        if (pointNum>4) {
            str = mContext.getResources().getString(R.string.point_one);
        } else if (pointNum>3 && pointNum<=4) {
            str = mContext.getResources().getString(R.string.point_two);
        } else if (pointNum>2 && pointNum<=3) {
            str = mContext.getResources().getString(R.string.point_three);
        } else if (pointNum>1 && pointNum<=2) {
            str = mContext.getResources().getString(R.string.point_four);
        } else if (pointNum>=0 && pointNum<=1) {
            str = mContext.getResources().getString(R.string.point_five);
        }
        return str;
    }

    private void addTags(List<GameTagInfoBean> tags, FlowLayout tips) {
        tips.removeAllViews();
        for (GameTagInfoBean tagInfoBean : tags) {
            LinearLayout linearLayout = (LinearLayout) LayoutInflater.from(mContext).inflate(
                    R.layout.search_label_tv, tips, false);
            TextView textView = linearLayout.findViewById(R.id.tipText);
            textView.setText(tagInfoBean.getName());
            textView.setPadding(mContext.getResources().getDimensionPixelOffset(R.dimen.wdp12), 0
                    , mContext.getResources().getDimensionPixelOffset(R.dimen.wdp12), 0);
            textView.setBackgroundResource(R.drawable.game_detial_tip_back);
            textView.setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                }
            });
            tips.addView(linearLayout);
        }
    }

    private int getRamDrawable() {
        int min=1;
        int max=6;
        Random random = new Random();
        int num = random.nextInt(max)%(max-min+1) + min;
        int mDrawable = R.drawable.game_detail_header_one_bg;
        switch (num) {
            case 1:
                mDrawable = R.drawable.game_detail_header_one_bg;
                break;
            case 2:
                mDrawable = R.drawable.game_detail_header_two_bg;
                break;
            case 3:
                mDrawable = R.drawable.game_detail_header_three_bg;
                break;
            case 4:
                mDrawable = R.drawable.game_detail_header_four_bg;
                break;
            case 5:
                mDrawable = R.drawable.game_detail_header_five_bg;
                break;
            case 6:
                mDrawable = R.drawable.game_detail_header_six_bg;
                break;
        }
        return mDrawable;
    }

    @Override
    public int getItemCount() {
        return datas.size();
    }

    public class HeaderTopHolder extends RecyclerView.ViewHolder {

        SimpleDraweeView detailHeaderBgIv;
        SimpleDraweeView detailHeaderIv;
        TextView detailHeaderGameNameTv;
        FlowLayout detailHeaderTipsFl;
        TextView detailHeaderTagTv;
        TextView detailHeaderPointTv;
        MStarBar detailHeaderMstarBar;
        TextView detailHeaderDecTx;
        RelativeLayout Ll1;

        public HeaderTopHolder(View view) {
            super(view);
            detailHeaderBgIv = view.findViewById(R.id.detailHeaderBgIv);
            detailHeaderIv = view.findViewById(R.id.detailHeaderIv);
            detailHeaderGameNameTv = view.findViewById(R.id.detailHeaderGameNameTv);
            detailHeaderTipsFl = view.findViewById(R.id.detailHeaderTipsFl);
            detailHeaderTagTv = view.findViewById(R.id.detailHeaderTagTv);
            detailHeaderPointTv = view.findViewById(R.id.detailHeaderPointTv);
            detailHeaderMstarBar = view.findViewById(R.id.detailHeaderMstarBar);
            detailHeaderDecTx = view.findViewById(R.id.detailHeaderDecTx);
            Ll1 = view.findViewById(R.id.Ll1);
        }
    }

    public class HeaderBottomHolder extends RecyclerView.ViewHolder {

        LinearLayout detailHeaderTwoBgIv;
        LinearLayout gameDetailCrackLl;
        TextView gameDetailCrackTx;
        LinearLayout gameDetailAdaptationSystemLl;
        TextView gameDetailAdaptationSystemTx;

        public HeaderBottomHolder(View view) {
            super(view);
            detailHeaderTwoBgIv = view.findViewById(R.id.detailHeaderTwoBgIv);
            gameDetailCrackLl = view.findViewById(R.id.gameDetailCrackLl);
            gameDetailCrackTx = view.findViewById(R.id.gameDetailCrackTx);
            gameDetailAdaptationSystemLl = view.findViewById(R.id.gameDetailAdaptationSystemLl);
            gameDetailAdaptationSystemTx = view.findViewById(R.id.gameDetailAdaptationSystemTx);
        }
    }

    public class PrizeHolder extends RecyclerView.ViewHolder {

        LinearLayout detailPrizeRootRl;
        SimpleDraweeView detailPrizeIv;
        TextView detailPrizeNameTv;
        TextView detailPrizeRankingTv;
        TextView detailPrizeLastTv;

        public PrizeHolder(View view) {
            super(view);
            detailPrizeRootRl = view.findViewById(R.id.detailPrizeRootRl);
            detailPrizeIv = view.findViewById(R.id.detailPrizeIv);
            detailPrizeNameTv = view.findViewById(R.id.detailPrizeNameTv);
            detailPrizeRankingTv = view.findViewById(R.id.detailPrizeRankingTv);
            detailPrizeLastTv = view.findViewById(R.id.detailPrizeLastTv);
        }
    }

    public class TitleHolder extends RecyclerView.ViewHolder {

        TextView detailTitleNameTv;

        public TitleHolder(View view) {
            super(view);
            detailTitleNameTv = view.findViewById(R.id.detailTitleNameTv);
        }
    }

    public class EditMessageHolder extends RecyclerView.ViewHolder {

        TextView detailEditMessageTv;

        public EditMessageHolder(View view) {
            super(view);
            detailEditMessageTv = view.findViewById(R.id.detailEditMessageTv);
        }
    }

    public class IntroduceHolder extends RecyclerView.ViewHolder {

        ImageView moreUpIv;
        TextView detailIntroduceTv;
        TextView detailIntroduceMoreTv;
        TextView uploadPeopleTx;
        TextView manufacturerTx;
        LinearLayout messageLl;

        public IntroduceHolder(View view) {
            super(view);
            moreUpIv = view.findViewById(R.id.moreUpIv);
            detailIntroduceTv = view.findViewById(R.id.detailIntroduceTv);
            detailIntroduceMoreTv = view.findViewById(R.id.detailIntroduceMoreTv);
            messageLl = view.findViewById(R.id.messageLl);
            uploadPeopleTx = view.findViewById(R.id.uploadPeopleTx);
            manufacturerTx = view.findViewById(R.id.manufacturerTx);
        }
    }

    public class PicListHolder extends RecyclerView.ViewHolder {

        RecyclerView detailScreenLv;
        LinearLayout imageItemRootLl;

        public PicListHolder(View view) {
            super(view);
            detailScreenLv = view.findViewById(R.id.detailScreenLv);
            imageItemRootLl = view.findViewById(R.id.imageItemRootLl);
        }
    }

    public class CommentTitleHolder extends RecyclerView.ViewHolder {

        LinearLayout detailNewCommentLl;
        TextView detailNewCommentNumTv;

        public CommentTitleHolder(View view) {
            super(view);
            detailNewCommentLl = view.findViewById(R.id.detailNewCommentLl);
            detailNewCommentNumTv = view.findViewById(R.id.detailNewCommentNumTv);
        }
    }

    public class CommentLineHolder extends RecyclerView.ViewHolder {

        public CommentLineHolder(View itemView) {
            super(itemView);
        }
    }
    public class CommentHolder extends RecyclerView.ViewHolder {

        LinearLayout commentAllRootLl;

        SimpleDraweeView userIcon;
        TextView userName;
        TextView isMe;
        ImageView isAuth;
        ImageView moreUpIv;
        TextView isConnoisseurs;
        MStarBar comment_head_mstarBar;
        TextView comment_head_num_tx;
        TextView time;
        ImageView isGood;
        TextView content;
        TextView more;
        public View line;
        TextView phoneModle;
        ImageView parise;
        TextView pariseNumber;
        ImageView down;
        TextView downNumber;
        ImageView message;
        TextView messageNumber;
        VipView levelTv;
        View layoutTop;
        LinearLayout detailNewStarLl;
        LinearLayout goCommit;

        public CommentHolder(View view) {
            super(view);
            commentAllRootLl = (LinearLayout) view.findViewById(R.id.commentAllRootLl);
            userIcon = (SimpleDraweeView) view.findViewById(R.id.usericon);
            userName = (TextView) view.findViewById(R.id.userName);
            isMe = (TextView) view.findViewById(R.id.isMe);
            isAuth = (ImageView) view.findViewById(R.id.isAuth);
            moreUpIv = (ImageView) view.findViewById(R.id.moreUpIv);
            isGood = (ImageView) view.findViewById(R.id.isGood);
            isConnoisseurs = (TextView) view.findViewById(R.id.isConnoisseurs);
            comment_head_mstarBar = (MStarBar) view.findViewById(R.id.comment_head_mstarBar);
            comment_head_num_tx = (TextView) view.findViewById(R.id.comment_head_num_tx);
            time = (TextView) view.findViewById(R.id.time);
            content = (TextView) view.findViewById(R.id.content);
            more = (TextView) view.findViewById(R.id.more);
//            line = view.findViewById(R.id.line);
            phoneModle = (TextView) view.findViewById(R.id.phoneModle);
            parise = (ImageView) view.findViewById(R.id.parise);
            pariseNumber = (TextView) view.findViewById(R.id.pariseNumber);
            down = (ImageView) view.findViewById(R.id.down);
            downNumber = (TextView) view.findViewById(R.id.downNumber);
            message = (ImageView) view.findViewById(R.id.message);
            messageNumber = (TextView) view.findViewById(R.id.messageNumber);
            levelTv = (VipView) view.findViewById(R.id.levelTv);
            layoutTop = view.findViewById(R.id.layoutTop);
            detailNewStarLl = view.findViewById(R.id.detailNewStarLl);
            goCommit = view.findViewById(R.id.goCommit);
        }
    }

    public class NoCommentHolder extends RecyclerView.ViewHolder {
        LinearLayout goCommit;
        LinearLayout detailNewStarLl;

        public NoCommentHolder(View view) {
            super(view);
            goCommit = view.findViewById(R.id.goCommit);
            detailNewStarLl = view.findViewById(R.id.detailNewStarLl);
        }
    }

    public class MayLikeHolder extends RecyclerView.ViewHolder {
        LinearLayout mayLikeOneLl;
        SimpleDraweeView mayLikeOneIv;
        TextView mayLikeOneGameNameTx;
        TextView mayLikeOneGamePointTx;
        TextView mayLikeOneGameStyleTx;
        TextView mayLikeOneGameRelationshopTx;
        LinearLayout mayLikeTwoLl;
        SimpleDraweeView mayLikeTwoIv;
        TextView mayLikeTwoGameNameTx;
        TextView mayLikeTwoGamePointTx;
        TextView mayLikeTwoGameStyleTx;
        TextView mayLikeTwoGameRelationshopTx;
        LinearLayout mayLikeThreeLl;
        SimpleDraweeView mayLikeThreeIv;
        TextView mayLikeThreeGameNameTx;
        TextView mayLikeThreeGamePointTx;
        TextView mayLikeThreeGameStyleTx;
        TextView mayLikeThreeGameRelationshopTx;

        public MayLikeHolder(View view) {
            super(view);
            mayLikeOneLl = view.findViewById(R.id.mayLikeOneLl);
            mayLikeOneIv = view.findViewById(R.id.mayLikeOneIv);
            mayLikeOneGameNameTx = view.findViewById(R.id.mayLikeOneGameNameTx);
            mayLikeOneGamePointTx = view.findViewById(R.id.mayLikeOneGamePointTx);
            mayLikeOneGameStyleTx = view.findViewById(R.id.mayLikeOneGameStyleTx);
            mayLikeOneGameRelationshopTx = view.findViewById(R.id.mayLikeOneGameRelationshopTx);
            mayLikeTwoLl = view.findViewById(R.id.mayLikeTwoLl);
            mayLikeTwoIv = view.findViewById(R.id.mayLikeTwoIv);
            mayLikeTwoGameNameTx = view.findViewById(R.id.mayLikeTwoGameNameTx);
            mayLikeTwoGamePointTx = view.findViewById(R.id.mayLikeTwoGamePointTx);
            mayLikeTwoGameStyleTx = view.findViewById(R.id.mayLikeTwoGameStyleTx);
            mayLikeTwoGameRelationshopTx = view.findViewById(R.id.mayLikeTwoGameRelationshopTx);
            mayLikeThreeLl = view.findViewById(R.id.mayLikeThreeLl);
            mayLikeThreeIv = view.findViewById(R.id.mayLikeThreeIv);
            mayLikeThreeGameNameTx = view.findViewById(R.id.mayLikeThreeGameNameTx);
            mayLikeThreeGamePointTx = view.findViewById(R.id.mayLikeThreeGamePointTx);
            mayLikeThreeGameStyleTx = view.findViewById(R.id.mayLikeThreeGameStyleTx);
            mayLikeThreeGameRelationshopTx = view.findViewById(R.id.mayLikeThreeGameRelationshopTx);
        }
    }

    public void showUrlBlur(SimpleDraweeView draweeView, String url, int blurRadius) {
        try {
            Uri uri = Uri.parse(url);
            ImageRequest request = ImageRequestBuilder.newBuilderWithSource(uri)
                    .setPostprocessor(new IterativeBoxBlurPostProcessor(6, blurRadius))
                    .build();
            AbstractDraweeController controller = Fresco.newDraweeControllerBuilder()
                    .setOldController(draweeView.getController())
                    .setImageRequest(request)
                    .build();
            draweeView.setController(controller);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

    public interface Listener {
        /**
         * 快速评论->发帖
         */
        void onPostingClick();

        void onPraise(CommentBaseBean bean, int position, int type);//点赞

        void onUnPraise(CommentBaseBean bean, int position, int type);//点踩

        void onRootView(CommentBaseBean bean);//item

        void onReflashThisView(String gameId);//item
    }
}
